<#include "../common/layout.ftl"/>
<@layout>
<div class="well">
	<span class="label label-success">修改员工资料</span>
	<form id="form1" class="well form-horizontal" action="../update"  method="post" enctype="multipart/form-data">
	  <input name="driver.id"  type="hidden" value="${driver.id}" >
	  <input name="driver.job_number"  type="hidden" value="${driver.job_number!""}" >
	  
	  <table  class="control-group">
	     <tr>
	        <td><label class="control-label" for="focusedInput">工号：</label></td>
	        <td><input class="input-xlarge focused" name="driver.job_number" id="job_number" type="text"  style="height: 26" value="${driver.job_number!""}" ></td>
	        <td><label class="control-label" for="focusedInput">修改密码：</label><input name="editpass" id="editpass" type="checkbox" value=""  onclick="edit();"/></td>
	        <td><input class="input-xlarge focused" name="password" id="driver.password" type="text" placeholder="请输入新密码" style="height: 26;display: none;" value="">
	        
	        </td>
	     </tr>
	     
	     
	      
	      <tr>
	        <td><label class="control-label" for="focusedInput">真实姓名：</label></td>
	        <td><input class="input-xlarge focused" name="driver.name" id="realname" type="text"  style="height: 26" value="${driver.name!""}" ></td>
	        
	        <td><label class="control-label" for="focusedInput">手机号码：</label></td>
	        <td><input class="input-xlarge focused" name="driver.phone" id="cellphone" type="text"  style="height: 26" value="${driver.phone!""}"></td>
	     </tr>
	     
	     <tr>
	        <td><label class="control-label" for="focusedInput">所属公司：</label></td>
	        <td>
	        	<input type='hidden' id="hidlicense_num" value="${driver.license_num!""}"/>
	            <select id="license_num" name="driver.license_num">
	        </td>
	        <td><label class="control-label" for="focusedInput">身份证号码：</label></td>
	        <td><input class="input-xlarge focused" name="driver.id_card" id="id_card" type="text"  style="height: 26"  value="${driver.id_card!""}"></td>
	        
	     </tr>
	      
	      <!--tr>
	        <td><label class="control-label" for="focusedInput">银行卡号：</label></td>
	        <td><input class="input-xlarge focused" name="driver.bank_no" id="id_card" type="text"  style="height: 26"  value="${driver.bank_no!""}"></td>
	        
	        <td><label class="control-label" for="focusedInput">MAC地址：</label></td>
	        <td><input class="input-xlarge focused" name="driver.mac" id="mac" type="text"  style="height: 26"  value="${driver.mac!""}"></td>
	     </tr-->
	     
	     <tr>
	        <td><label class="control-label" for="focusedInput">籍贯：</label></td>
	        <td><input class="input-xlarge focused" name="driver.hometown" id="hometown" type="text"  style="height: 26" value="${driver.hometown!""}" ></td>
	        
	        <td><label class="control-label" for="focusedInput">年龄：</label></td>
	        <td><input class="input-xlarge focused" name="driver.age" id="age"  type="text"  style="height: 26"  value="${driver.age!""}"></td>
	     </tr>
	     
	      <tr>
	        <td><label class="control-label" for="focusedInput">驾龄：</label></td>
	        <td><input class="input-xlarge focused" name="driver.driver_age" id="driver_age"  type="text" value="${driver.driver_age!""}" ></td>
	        
	        <td><label class="control-label" for="focusedInput">驾照：</label></td>
	        <td>
	           <select id="driver_license" name="driver.driver_license">
                <option value="A1" <#if driver.driver_license=='A1' >selected</#if>>A1</option>
                <option value="A2" <#if driver.driver_license=='A2' >selected</#if>>A2</option>
                <option value="A3" <#if driver.driver_license=='A3' >selected</#if>>A3</option>
                <option value="B1" <#if driver.driver_license=='B1' >selected</#if>>B1</option>
                <option value="B2" <#if driver.driver_license=='B2' >selected</#if>>B2</option>
                <option value="C1" <#if driver.driver_license=='C1' >selected</#if>>C1</option>
                <option value="C2" <#if driver.driver_license=='C2' >selected</#if>>C2</option>
              </select>
	        </td>
	     </tr>
	     
	     <tr>
	        <td><label class="control-label" for="focusedInput">性别：</label></td>
	        <td>
	            <select id="sex" name="driver.sex">
                <option value="0" <#if driver.sex==0 >selected</#if>>男</option>
                <option value="1" <#if driver.sex==1 >selected</#if>>女</option>
                <option value="2" <#if driver.sex==2 >selected</#if>>未知</option>
              </select>
	        </td>
	        
	        <td><label class="control-label" for="focusedInput">头像：</label></td>
	        <td>
	           <input class="input-xlarge focused" name="driver.head"  type="file"  style="height: 26">
	           <img style="width:20px;height:20px;" src="/upload/${driver.head!"default_avatar.gif"}"/>
	        </td>
	        
	     </tr>
	     <tr>
	        <td><label class="control-label" for="focusedInput">军衔：</label></td>
	        <td>
	            <input class="input-xlarge focused" name="driver.level" value="${driver.level!""}" type="text" style="height: 26" >
	        </td>
	        <td><label class="control-label" for="focusedInput">积分：</label></td>
	        <td>
	           <input class="input-xlarge focused" name="driver.point" value="${driver.point!""}" type="text" style="height: 26" >
	        </td>
	     </tr>
	     <tr>
	        <td><label class="control-label" for="focusedInput">身份证图片：</label></td>
	        <td>
	            <input class="input-xlarge focused" name="driver.id_card_img" value="${driver.id_card_img!""}" type="file" style="height: 26" >
	            <img style="width:20px;height:20px;" src="/upload/${driver.id_card_img!"default_avatar.gif"}"/>
	        </td>
	        <td><label class="control-label" for="focusedInput">驾照图片：</label></td>
	        <td>
	           <input class="input-xlarge focused" name="driver.driver_license_img" value="${driver.driver_license_img!""}" type="file" style="height: 26" >
	           <img style="width:20px;height:20px;" src="/upload/${driver.driver_license_img!"default_avatar.gif"}"/>
	        </td>
	     </tr>
	     <tr>
	     	<td>
	     		<label class="control-label" for="focusedInput">可接订单类型：</label>
	     	</td>
	     	<td>
	     		<#if driver.post?exists>
		     		<input name="post" type="checkbox" value="0" <#if driver.post?index_of("0")!=-1>checked</#if>>代驾员
		     		<input name="post" type="checkbox" value="1"  <#if driver.post?index_of("1")!=-1>checked</#if>  />配送员
		     		<input name="post" type="checkbox" value="2"  <#if driver.post?index_of("2")!=-1>checked</#if> />保镖员
		     		<input name="post" type="checkbox" value="3"  <#if driver.post?index_of("3")!=-1>checked</#if>/>泊车员
		     	<#else>
		     		<input name="post" type="checkbox" value="0" />代驾员
		     		<input name="post" type="checkbox" value="1"  />配送员
		     		<input name="post" type="checkbox" value="2"   />保镖员
		     		<input name="post" type="checkbox" value="3" />泊车员
		     	</#if>
		     	
	     	</td>
	     </tr>
	     
	     </table>
	     
      
       
      <div class="form-actions">
        <button type="submit" class="btn btn-primary" onsubmit="save()">确 定</button>
        <button type="reset" class="btn">重 置</button>
        <button type="button" class="btn btn-info" onclick="javascript:history.back();">返回</button>
      </div>
  </form>
  </div>

<script>
	function edit(){
	    if($("#editpass").attr("checked")=="checked")
     	{
      		
     		$("#driver\\.password").show();
			alert("ok1");
		}
		else
		{
			
			$("#driver\\.password").hide();
			alert("ok2");
		}
	    
	}
	
	
	$(function() { 
	
		$.ajax({
		    type:'POST',
		    url:"../listLicensenum",
		    dataType:"json",
		    success:function(result){
		    	$(result.record).each(function(){
		    		var selected = "";
		    		if($(this).attr('company') == $("#hidlicense_num").val()){
		    			selected = "selected";
		    		}
		    		var option = "<option value='"+$(this).attr('company')+"' "+selected+">"+$(this).attr('companyname')+"</option>";
		    		$("#license_num").append(option);
		    	});
		    },error:function(result){
		    	//alert(result);
		    }
		});
	
	
     $("#form1").validity(function() {
     
     	if($("#editpass").attr("checked")=="checked")
     	{
          $("#password").require();
        }
         $("#realname").require();
         $("#cellphone").require().match("number");
         $("#mac").require();
         $("#id_card").require();
         $("#hometown").require();
         $("#age").require().match("number");
         $("#driver_age").require().match("number");
         $("#bank_no").require().match("number");
     });
     
 }); 
</script>
</@layout>